package com.wh.wisdomsite.xbox.ba.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.wh.wisdomsite.xbox.ba.dao.ServiceMethodMapper;
import com.wh.wisdomsite.xbox.ba.entity.ServiceMethod;
import com.wh.wisdomsite.xbox.ba.service.IServiceMethodService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 服务方法ServiceImpl
 * @Package com.wh.wisdomsite.xbox.ba.service.impl
 * @author 谢泽鹏
 * @date 2014年10月8日 下午4:02:14
 * @Copyright 个人版权所有
 * @Company 贵州万华科技有限公司Copyright (c) 2014
 * @version V1.0
 */
@Service("serviceMethodService")
@Transactional(rollbackFor = {Exception.class,RuntimeException.class})
public class ServiceMethodServiceImpl extends ServiceImpl<ServiceMethodMapper, ServiceMethod> implements IServiceMethodService {

    private static final Log logger = LogFactory.getLog(ServiceMethodServiceImpl.class);

    @Autowired()
    private ServiceMethodMapper serviceMethodMapper;

    @Override
    public Map<String, String> getServiceMethodTitle() {
        Map<String, String> serviceMethodMap = new HashMap<String, String>();
        EntityWrapper<ServiceMethod> ewServiceMethod = new EntityWrapper<ServiceMethod>();
        ewServiceMethod.setEntity(new ServiceMethod());
        List<ServiceMethod> serviceMethodList = serviceMethodMapper.selectList(ewServiceMethod);
        for(ServiceMethod serviceMethod : serviceMethodList){
            serviceMethodMap.put(serviceMethod.getMethod() + "$" + serviceMethod.getVersion() + "$TITLE", serviceMethod.getTitle());
            serviceMethodMap.put(serviceMethod.getMethod() + "$" + serviceMethod.getVersion() + "$REMARK", serviceMethod.getRemark());
        }
        return serviceMethodMap;
    }


}